<% content_for :head do %>
  <script type="text/javascript">
  $(document).ready(function(){
    $('.toggle_quote').show().click(function(){
      $(this).parent().parent().find('p:last').toggle();
      return false;
    });
  });
  </script>
<% end %>

<div id='actions'>
  <ul>
    <li>
      <%= render :partial => "/shared/admin/search", :locals => {:url => admin_testimonials_url} %>
    </li>
    <li>
      <%= link_to "Create New Testimonial", new_admin_testimonial_url, :class => "add_icon" %>
    </li>
  <% if !searching? and Testimonial.count > 1 %>
    <li>
      <%= link_to "Reorder Testimonials", admin_testimonials_url, :id => "reorder_action", :class => "reorder_icon" %>
      <%= link_to "Done Reordering Testimonials", admin_testimonials_url, :id => "reorder_action_done", :style => "display: none;", :class => "reorder_icon" %>
    </li>
  <% end %>
  </ul>
</div>

<div id='records'>
  <% if searching? %>
    <h2>Search Results for "<%= params[:search] %>"</h2>
    <% if @testimonials.size > 0 %>
      <%= render :partial => "testimonial", :collection => @testimonials %>
    <% else %>
      <p>Sorry, no results found.</p>
    <% end %>
  <% else %>
    <% if @testimonials.size > 0 %>
      <%= will_paginate @testimonials, :previous_label => '&laquo;', :next_label => '&raquo;' %>
       <ul id='sortable_list'>
        <%= render :partial => "sortable_list" %>
       </ul>
      <%= will_paginate @testimonials, :previous_label => '&laquo;', :next_label => '&raquo;' %>
    <% else %>
      <p>
        <strong>
          There are no testimonials yet.
          Click "Create New Testimonial" to add your first testimonial.
        </strong>
      </p>
    <% end %>
  <% end %>
</div>
<%= render :partial => "/shared/admin/make_sortable", :locals => {:tree => false } if !searching? and Testimonial.count > 1 %>
